import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: '首页',
    component: () => import('../views/Home.vue')
  },
  {
    path: '/content', // 内容
    name: 'Content',
    component: () => import('../components/Content.vue')
  },
  {
    path: '/footer', // 底部
    name: 'Footer',
    component: () => import('../components/footer.vue')
  },
  {
    path: '/works', // 编辑推荐
    name: 'Works',
    component: () => import('../views/menu/works.vue')
  },
  {
    path: '/top', // 排行榜
    name: 'Top',
    component: () => import('../views/menu/top.vue')
  },
  {
    path: '/branchs', // 设计组织
    name: 'Branchs',
    component: () => import('../views/menu/branchs.vue')
  },
  {
    path: '/branch', // 系别
    name: 'Branch', 
    component: () => import('../views/departments/branch.vue')
  },
  {
    path: '/computer/branchdetail', // 专业详情
    name: 'BranchDetail',
    component: () => import('../views/detail/branch-detail.vue')
  },
  {
    path: '/computer/branchdetail/workdetail', // 作品详情
    name: 'WorkDetail',
    component: () => import('../views/detail/work-detail.vue')
  },
]

let router = new VueRouter({
  mode: 'history', // 路由使用history模式
  routes
})


// 后期需要的话添加全局前置守卫
// router.beforeEach((to, from, next) => {
//   let tokenStr = true
//   if(!tokenStr && to.name == '首页')  next('/top')
  
//   next()
// })

export default router
